/**
 * @file    drv_lpm.h
 * @brief   低功耗驱动
 * @author  Liuwei
 * @version 1.0.1
 * @date    2023-06-17
 * 
 * @copyright Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version   <th>Author   <th>Description
 * <tr><td>2023-06-17 <td>1.0.1     <td>Liuwei   <td>首次创建
 * </table>
 */

#ifndef __DRV_LPM_H_
#define __DRV_LPM_H_

/* File Includes -------------------------------------------------------------*/
#include "mcu_type.h"

/* Cplusplus -----------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif

/* Macro/Define/Typedef ------------------------------------------------------*/
typedef enum
{
	LMP_MODE_IDLE   ,   
	LMP_MODE_LOW_POW  ,  
	LMP_MODE_SHUT_DOWN  ,
}lmp_mode_type;

#define LMP_WK_CHG_PIN        (1<<0)
#define LMP_WK_COM_PIN        (1<<1)
#define LMP_WK_KEY_PIN        (1<<2)
#define LMP_WK_CAN_PIN        (1<<3)
#define LMP_SW_KEY_PIN        (1<<4)

#define SYS_LP_STOP       (0)
#define SYS_LP_STADNBY    (1)
#define SYS_LP_SHUNTDOWN  (2)
#define SYS_WAIT_SLEEP    (3)

#define SLEEP_WK_SRC_WDT  (1)
#define SLEEP_WK_SRC_CHG  (2)
#define SLEEP_WK_SRC_CAN  (3)
#define SLEEP_WK_SRC_KEY  (4)
#define SLEEP_WK_SRC_COM  (5)
#define SLEEP_WK_SRC_SW   (6)

/* @brief */

/* Variables -----------------------------------------------------------------*/
extern uint8_t sleep_wk_src;
/*******************************************************************************
 * public API List
 ******************************************************************************/
void drv_lpm_into_mode(lmp_mode_type lmp_mode ,uint32_t wk_pin , uint32_t wk_time);
void drv_lmp_into_idle_sleep(void);
/*! @} End of Interface API List */

#ifdef __cplusplus
}
#endif

#endif  /* #ifndef __DRV_LPM_H_ */
/********** Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD *********/

